// ini_test.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//

#include <iostream>
#include "inifile.h"

int main()
{
	char remote_ip[16] = { 0 };
	int nRet = 0;
	char ftpport[16] = { 0 };
	char ftpuser[16] = { 0 };
	char ftppasswd[16] = { 0 };

    CIniFile Inifile;
	if (Inifile.load("localset.ini")) {
		printf("Configuration file path error");
		return false;
	}

	strcpy(remote_ip, Inifile.getStringValue("", "remote_ip", nRet).c_str());
	std::cout << remote_ip << "\n";

	Inifile.setValue("MySQL_info", "ftpprot","22");
	strcpy(ftpport, Inifile.getStringValue("MySQL_info", "ftpprot", nRet).c_str());
	strcpy(ftpuser, Inifile.getStringValue("MySQL_info", "ftpuser", nRet).c_str());
	strcpy(ftppasswd, Inifile.getStringValue("MySQL_info", "ftppasswd", nRet).c_str());

	std::cout << ftpport <<"\n";
	std::cout << ftpuser << "\n";
	std::cout << ftppasswd << "\n";

	strcpy(ftpport, Inifile.getStringValue("MySQL_info_1", "ftpprot", nRet).c_str());
	strcpy(ftpuser, Inifile.getStringValue("MySQL_info_1", "ftpuser", nRet).c_str());
	strcpy(ftppasswd, Inifile.getStringValue("MySQL_info_1", "ftppasswd", nRet).c_str());

	std::cout << ftpport << "\n";
	std::cout << ftpuser << "\n";
	std::cout << ftppasswd << "\n";

	Inifile.save();
    std::cout << "Hello World!\n";
}
